<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">

</script>
</head>
<body>
<table border="1" width="1000">
	<tr>
		<td colspan="8" align="right"><a href="${pageContext.request.contextPath}/student/addStudent.jsp">添加学生</a></td>
	</tr>
	<tr>
		<td>编号</td>
		<td>姓名</td>
		<td>性别</td>
		<td>邮箱</td>
		<td>电话</td>
		<td>地址</td>
		<td>年龄</td>
		<td>操作</td>
	</tr>
	<c:forEach var="s" items="${students }">
		<tr>
			<td>${s.sid }</td>
			<td>${s.sname }</td>
			<td>${s.sex }</td>
			<td>${s.email }</td>
			<td>${s.telephone }</td>
			<td>${s.addr }</td>
			<td>${s.age }</td>
			<td><a href="${pageContext.request.contextPath}/StudentFindByIdServlet1?sid=${s.sid }">编辑</a>|<a href="#" onclick="deleteStudent(${s.sid })">删除</a></td>
		</tr>
	</c:forEach>
</table>
</body>
<script type="text/javascript" >
	//删除函数
	function deleteStudent(sid){
		var flag = window.confirm("你确定要删除吗?");
		if(flag){//确定删除
			
			window.location.href="${pageContext.request.contextPath}/StudentDeleteServlet1?sid="+sid;
		}
		
		
	};
</script>
</html>